package com.example.gzysmartcity.ui.adapter;

import android.widget.TextView;

import com.blankj.utilcode.util.ToastUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.example.gzysmartcity.R;
import com.example.gzysmartcity.repository.model.SCVisit;

import org.jetbrains.annotations.NotNull;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class DoctorTimeRvAdpater extends BaseQuickAdapter<SCVisit.DataBean, BaseViewHolder> {
    public DoctorTimeRvAdpater(int layoutResId) {
        super(layoutResId);
        simpleDateFormat = new SimpleDateFormat("yyyy.MM.dd kk:mm", Locale.CHINA);
    }
    private final SimpleDateFormat simpleDateFormat;

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, SCVisit.DataBean dataBean) {
        String format = simpleDateFormat.format(new Date((long)dataBean.getTreatmentDate() * 1000));
        if (dataBean.getTimeType() == 0) {
            baseViewHolder.setText(R.id.tv_time_up,format);
        } else if (dataBean.getTimeType() == 1) {
            baseViewHolder.setText(R.id.tv_time_up,format);
        }
        TextView tv=(TextView)baseViewHolder.getView(R.id.tv_time_down);
        tv.setOnClickListener(v->{
            ToastUtils.showShort("预约成功");
        });
    }
}
